home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 4
/
Mac Giga-ROM 4.0 - 1993.toast
/
FILES
/
DEV
/
A-B
/
002. TESample.cpt
/
TESample.r
< prev
next >
Wrap
Text File
|
1988-08-01
|
8KB
|
342 lines
/*------------------------------------------------------------------------------
#
# Apple Macintosh Developer Technical Support
#
# MultiFinder-Aware TextEdit Sample Application
#
# TESample
#
# TESample.r - Rez Source
#
# Copyright © 1988 Apple Computer, Inc.
# All rights reserved.
#
# Versions: 1.0 8/88
#
# Components: TESample.p August 1, 1988
# TESample.c August 1, 1988
# TESample.a August 1, 1988
# TESample.r August 1, 1988
# TESample.h August 1, 1988
# PTESample.make August 1, 1988
# CTESample.make August 1, 1988
#
# TESample is an example application that demonstrates how
# to initialize the commonly used toolbox managers, operate
# successfully under MultiFinder, handle desk accessories and
# create, grow, and zoom windows. The fundamental TextEdit
# toolbox calls and TextEdit autoscroll are demonstrated. It
# also shows how to create and maintain scrollbar controls.
#
# It does not by any means demonstrate all the techniques you
# need for a large application. In particular, Sample does not
# cover exception handling, multiple windows/documents,
# sophisticated memory management, printing, or undo. All of
# these are vital parts of a normal full-sized application.
#
# This application is an example of the form of a Macintosh
# application; it is NOT a template. It is NOT intended to be
# used as a foundation for the next world-class, best-selling,
# 600K application. A stick figure drawing of the human body may
# be a good example of the form for a painting, but that does not
# mean it should be used as the basis for the next Mona Lisa.
#
# We recommend that you review this program or Sample before
# beginning a new application. Sample is a simple app. which doesn’t
# use TextEdit or the Control Manager.
#
------------------------------------------------------------------------------*/
#include "SysTypes.r"
#include "Types.r"
#include "TESample.h"
type 'vers' {
hex byte; /* Major revision in BCD*/
hex byte; /* Minor vevision in BCD*/
hex byte development = 0x20, /* Release stage */
alpha = 0x40,
beta = 0x60,
final = 0x80, /* or */ release = 0x80;
hex byte; /* Non-final release # */
integer Country; /* Country code */
pstring; /* Short version number */
pstring; /* Long version number */
};
resource 'vers' (1) {
0x01, 0x00, release, 0x00,
verUS,
"1.00",
"1.00, Copyright © 1988 Apple Computer, Inc."
};
/* we use an MBAR resource to conveniently load all the menus */
resource 'MBAR' (rMenuBar, preload) {
{ mApple, mFile, mEdit }; /* three menus */
};
resource 'MENU' (mApple, preload) {
mApple, textMenuProc,
0b1111111111111111111111111111101, /* disable dashed line, enable About and DAs */
enabled, apple,
{
"About TESample…",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain
}
};
resource 'MENU' (mFile, preload) {
mFile, textMenuProc,
0b0000000000000000000100000000000, /* enable Quit only, program enables others */
enabled, "File",
{
"New",
noicon, "N", nomark, plain;
"Open",
noicon, "O", nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Close",
noicon, "W", nomark, plain;
"Save",
noicon, "S", nomark, plain;
"Save As…",
noicon, nokey, nomark, plain;
"Revert",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Page Setup…",
noicon, nokey, nomark, plain;
"Print…",
noicon, nokey, nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Quit",
noicon, "Q", nomark, plain
}
};
resource 'MENU' (mEdit, preload) {
mEdit, textMenuProc,
0b0000000000000000000000000000000, /* disable everything, program does the enabling */
enabled, "Edit",
{
"Undo",
noicon, "Z", nomark, plain;
"-",
noicon, nokey, nomark, plain;
"Cut",
noicon, "X", nomark, plain;
"Copy",
noicon, "C", nomark, plain;
"Paste",
noicon, "V", nomark, plain;
"Clear",
noicon, nokey, nomark, plain
}
};
/* this ALRT and DITL are used as an About screen */
resource 'ALRT' (rAboutAlert, purgeable) {
{40, 20, 160, 296}, rAboutAlert, {
OK, visible, silent;
OK, visible, silent;
OK, visible, silent;
OK, visible, silent
};
};
resource 'DITL' (rAboutAlert, purgeable) {
{ /* array DITLarray: 5 elements */
/* [1] */
{88, 184, 108, 264},
Button {
enabled,
"OK"
},
/* [2] */
{8, 8, 24, 274},
StaticText {
disabled,
"MultiFinder-Aware TextEdit Application"
},
/* [3] */
{32, 8, 48, 237},
StaticText {
disabled,
"Copyright © 1988 Apple Computer"
},
/* [4] */
{56, 8, 72, 136},
StaticText {
disabled,
"Brought to you by:"
},
/* [5] */
{80, 24, 112, 167},
StaticText {
disabled,
"Macintosh Developer Technical Support"
}
}
};
/* this ALRT and DITL are used to signal an error in editing */
resource 'ALRT' (rEditAlert, purgeable) {
{40, 20, 160, 292}, rEditAlert, {
OK, visible, silent;
OK, visible, silent;
OK, visible, silent;
OK, visible, silent
};
};
resource 'DITL' (rEditAlert, purgeable) {
{ /* array DITLarray: 3 elements */
/* [1] */
{88, 180, 108, 260},
Button {
enabled,
"OK"
},
/* [2] */
{8, 8, 41, 41},
Icon {
disabled,
0
},
/* [3] */
{8, 60, 80, 260},
StaticText {
disabled,
"Sorry, but that Edit command could not b"
"e completed."
}
}
};
resource 'WIND' (rDocWindow, preload, purgeable) {
{64, 60, 314, 460},
zoomDocProc, invisible, goAway, 0x0, "untitled"
};
resource 'CNTL' (rVScroll, preload) {
{-1, 385, 236, 401},
0, visible, 0, 0, scrollBarProc, 0, ""
};
resource 'CNTL' (rHScroll, preload) {
{235, -1, 251, 386},
0, visible, 0, 0, scrollBarProc, 0, ""
};
/* we put the latest SIZE template here so we can rez with MPW 2.0 */
type 'SIZE' {
boolean dontSaveScreen,
saveScreen;
boolean ignoreSuspendResumeEvents,
acceptSuspendResumeEvents;
boolean enableOptionSwitch,
disableOptionSwitch;
boolean cannotBackground,
canBackground;
boolean notMultiFinderAware,
multiFinderAware;
boolean notOnlyBackground,
onlyBackground;
boolean dontGetFrontClicks,
getFrontClicks;
unsigned bitstring[9] = 0;
unsigned longint; /* preferred memory size in bytes */
unsigned longint; /* minimum memory size in bytes */
}; /* ignore the warning caused by re-defining SIZE */
/* here is the quintessential MultiFinder friendliness device, the SIZE resource */
resource 'SIZE' (-1) {
dontSaveScreen,
acceptSuspendResumeEvents,
enableOptionSwitch,
canBackground, /* we can background; we don't currently, but our sleep value */
/* guarantees we don't hog the Mac while we are in the background */
multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */
notOnlyBackground, /* this is definitely note a background-only application! */
dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */
kPrefSize * 1024,
kMinSize * 1024
};
type 'MOOT' as 'STR ';
resource 'MOOT' (0) {
"MultiFinder-Aware TextEdit Sample Application"
};
resource 'BNDL' (128) {
'MOOT',
0,
{
'ICN#',
{
0, 128
},
'FREF',
{
0, 128
}
}
};
resource 'FREF' (128) {
'APPL',
0,
""
};
resource 'ICN#' (128) {
{ /* array: 2 elements */
/* [1] */
$"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
$"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
$"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
$"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
$"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
$"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
$"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
$"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
/* [2] */
$"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
$"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
$"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
$"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
$"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
$"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
$"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
$"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
}
};